import { _ as _export_sfc, m as mpMixin, a as mixin, c as createBlock, o as openBlock, w as withCtx, t as createTextVNode, u as toDisplayString, n as normalizeStyle, M as withModifiers, s as index$i, aw as func, ax as priceFormat, ay as date, az as error, aA as timeFormat, j as resolveEasycom, J as __easycom_0, k as resolveDynamicComponent, e as createCommentVNode, f as normalizeClass, i as index$g, b as createVNode, Q as index$x, a2 as makePhoneCall, aB as range, r as renderSlot, g as createElementBlock, F as Fragment, p as index$q, x as useMainStore, y as storeToRefs, z as ref, al as useNavbarHeight, B as onLoad, X as formatDateTime, U as onShow, A as computed, H as unref, G as __easycom_0$1, ae as Input, aq as index$7, aC as uploadFile, aD as VUE_APP_UPLOAD_URL, aE as userEdit, ag as navigateBack } from './index-Cc4oxzDN.js';
import { _ as __easycom_2$1 } from './list-cell.BHNnBKKp.js';

const props$2 = {
	props: {
		// 文字颜色
		color: {
			type: String,
			default: ''
		},
		// 字体大小，单位px
		fontSize: {
			type: [String, Number],
			default: 14
		},
		// 是否显示下划线
		underLine: {
			type: Boolean,
			default: false
		},
		// 要跳转的链接
		href: {
			type: String,
			default: ''
		},
		// 小程序中复制到粘贴板的提示语
		mpTips: {
			type: String,
			default: '链接已复制，请在浏览器打开'
		},
		// 下划线颜色
		lineColor: {
			type: String,
			default: ''
		},
		// 超链接的问题，不使用slot形式传入，是因为nvue下无法修改颜色
		text: {
			type: String,
			default: ''
		},
		...uni.$uv?.props?.link
	}
};

/**
	 * link 超链接
	 * @description 该组件为超链接组件，在不同平台有不同表现形式：在APP平台会通过plus环境打开内置浏览器，在小程序中把链接复制到粘贴板，同时提示信息，在H5中通过window.open打开链接。
	 * @tutorial https://www.uvui.cn/components/link.html
	 * @property {String}			color		文字颜色 （默认 color['uv-primary'] ）
	 * @property {String ｜ Number}	fontSize	字体大小，单位px （默认 15 ）
	 * @property {Boolean}			underLine	是否显示下划线 （默认 false ）
	 * @property {String}			href		跳转的链接，要带上http(s)
	 * @property {String}			mpTips		各个小程序平台把链接复制到粘贴板后的提示语（默认“链接已复制，请在浏览器打开”）
	 * @property {String}			lineColor	下划线颜色，默认同color参数颜色 
	 * @property {String}			text		超链接的问题，不使用slot形式传入，是因为nvue下无法修改颜色 
	 * @property {Object}			customStyle	定义需要用到的外部样式
	 * 
	 * @example <uv-link href="http://www.uvui.cn">蜀道难，难于上青天</uv-link>
	 */
	const _sfc_main$3 = {
		name: "uv-link",
		emits:['click'],
		mixins: [mpMixin, mixin, props$2],
		computed: {
			linkStyle() {
				const style = {
					color: this.color,
					fontSize: this.$uv.addUnit(this.fontSize),
					// line-height设置为比字体大小多2px
					lineHeight: this.$uv.addUnit(this.$uv.getPx(this.fontSize) + 2),
					textDecoration: this.underLine ? 'underline' : 'none'
				};
				return style
			}
		},
		methods: {
			openLink() {




				window.open(this.href);












				this.$emit('click');
			}
		}
	};

function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  const _component_v_uni_text = index$i;

  return (openBlock(), createBlock(_component_v_uni_text, {
    class: "uv-link",
    onClick: withModifiers($options.openLink, ["stop"]),
    style: normalizeStyle([$options.linkStyle, _ctx.$uv.addStyle(_ctx.customStyle)])
  }, {
    default: withCtx(() => [
      createTextVNode(toDisplayString(_ctx.text), 1)
    ]),
    _: 1
  }, 8, ["onClick", "style"]))
}
const __easycom_3 = /*#__PURE__*/_export_sfc(_sfc_main$3, [['render',_sfc_render$2],['__scopeId',"data-v-3420edd1"]]);

const value = {
    computed: {
        // 经处理后需要显示的值
        value() {
            const {
                text,
                mode,
                format,
                href
            } = this;
            // 价格类型
            if (mode === 'price') {
                // 进行格式化，判断用户传入的format参数为正则，或者函数，如果没有传入format，则使用默认的金额格式化处理
                if (func(format)) {
                    // 如果用户传入的是函数，使用函数格式化
                    return format(text)
                }
                // 如果format非正则，非函数，则使用默认的金额格式化方法进行操作
                return priceFormat(text, 2)
            } if (mode === 'date') {
                // 判断是否合法的日期或者时间戳
                !date(text) && error();
                // 进行格式化，判断用户传入的format参数为正则，或者函数，如果没有传入format，则使用默认的格式化处理
                if (func(format)) {
                    // 如果用户传入的是函数，使用函数格式化
                    return format(text)
                } if (format) {
                    // 如果format非正则，非函数，则使用默认的时间格式化方法进行操作
                    return timeFormat(text, format)
                }
                // 如果没有设置format，则设置为默认的时间格式化形式
                return timeFormat(text, 'yyyy-mm-dd')
            } if (mode === 'phone') {
                // 判断是否合法的手机号
                // !mobile(text) && error('手机号模式下，text参数需要为手机号码格式')
                if (func(format)) {
                    // 如果用户传入的是函数，使用函数格式化
                    return format(text)
                } if (format === 'encrypt') {
                    // 如果format为encrypt，则将手机号进行星号加密处理
                    return `${text.substr(0, 3)}****${text.substr(7)}`
                }
                return text
            } if (mode === 'name') {
                if (func(format)) {
                    // 如果用户传入的是函数，使用函数格式化
                    return format(text)
                } if (format === 'encrypt') {
                    // 如果format为encrypt，则将姓名进行星号加密处理
                    return this.formatName(text)
                }
                return text
            } if (mode === 'link') {
                return text
            }
            return text
        }
    },
    methods: {
        // 默认的姓名脱敏规则
        formatName(name) {
            let value = '';
            if (name.length === 2) {
                value = name.substr(0, 1) + '*';
            } else if (name.length > 2) {
                let char = '';
                for (let i = 0, len = name.length - 2; i < len; i++) {
                    char += '*';
                }
                value = name.substr(0, 1) + char + name.substr(-1, 1);
            } else {
                value = name;
            }
            return value
        }
    }
};

const props$1 = {
	props: {
		// 主题颜色
		type: {
			type: String,
			default: ''
		},
		// 是否显示
		show: {
			type: Boolean,
			default: true
		},
		// 显示的值
		text: {
			type: [String, Number],
			default: ''
		},
		// 前置图标
		prefixIcon: {
			type: String,
			default: ''
		},
		// 后置图标
		suffixIcon: {
			type: String,
			default: ''
		},
		// 文本处理的匹配模式
		// text-普通文本，price-价格，phone-手机号，name-姓名，date-日期，link-超链接
		mode: {
			type: String,
			default: ''
		},
		// mode=link下，配置的链接
		href: {
			type: String,
			default: ''
		},
		// 格式化规则
		format: {
			type: [String, Function],
			default: ''
		},
		// mode=phone时，点击文本是否拨打电话
		call: {
			type: Boolean,
			default: true
		},
		// 小程序的打开方式
		openType: {
			type: String,
			default: ''
		},
		// 是否粗体，默认normal
		bold: {
			type: Boolean,
			default: false
		},
		// 是否块状
		block: {
			type: Boolean,
			default: false
		},
		// 文本显示的行数，如果设置，超出此行数，将会显示省略号
		lines: {
			type: [String, Number],
			default: ''
		},
		// 文本颜色
		color: {
			type: String,
			default: '#303133'
		},
		// 字体大小
		size: {
			type: [String, Number],
			default: 15
		},
		// 图标的样式
		iconStyle: {
			type: [Object, String],
			default: () => ({
				fontSize: '15px'
			})
		},
		// 文字装饰，下划线，中划线等，可选值 none|underline|line-through
		decoration: {
			type: String,
			default: 'none'
		},
		// 外边距，对象、字符串，数值形式均可
		margin: {
			type: [Object, String, Number],
			default: 0
		},
		// 文本行高
		lineHeight: {
			type: [String, Number],
			default: ''
		},
		// 文本对齐方式，可选值left|center|right
		align: {
			type: String,
			default: 'left'
		},
		// 文字换行，可选值break-word|normal|anywhere
		wordWrap: {
			type: String,
			default: 'normal'
		},
		...uni.$uv?.props?.text
	}
};

/**
	 * Text 文本
	 * @description 此组件集成了文本类在项目中的常用功能，包括状态，拨打电话，格式化日期，*替换，超链接...等功能。 您大可不必在使用特殊文本时自己定义，text组件几乎涵盖您能使用的大部分场景。
	 * @tutorial https://www.uvui.cn/components/loading.html
	 * @property {String} 					type		主题颜色
	 * @property {Boolean} 					show		是否显示（默认 true ）
	 * @property {String | Number}			text		显示的值
	 * @property {String}					prefixIcon	前置图标
	 * @property {String} 					suffixIcon	后置图标
	 * @property {String} 					mode		文本处理的匹配模式 text-普通文本，price-价格，phone-手机号，name-姓名，date-日期，link-超链接
	 * @property {String} 					href		mode=link下，配置的链接
	 * @property {String | Function} 		format		格式化规则
	 * @property {Boolean} 					call		mode=phone时，点击文本是否拨打电话（默认 false ）
	 * @property {String} 					openType	小程序的打开方式
	 * @property {Boolean} 					bold		是否粗体，默认normal（默认 false ）
	 * @property {Boolean} 					block		是否块状（默认 false ）
	 * @property {String | Number} 			lines		文本显示的行数，如果设置，超出此行数，将会显示省略号
	 * @property {String} 					color		文本颜色（默认 '#303133' ）
	 * @property {String | Number} 			size		字体大小（默认 15 ）
	 * @property {Object | String} 			iconStyle	图标的样式 （默认 {fontSize: '15px'} ）
	 * @property {String} 					decoration	文字装饰，下划线，中划线等，可选值 none|underline|line-through（默认 'none' ）
	 * @property {Object | String | Number}	margin		外边距，对象、字符串，数值形式均可（默认 0 ）
	 * @property {String | Number} 			lineHeight	文本行高
	 * @property {String} 					align		文本对齐方式，可选值left|center|right（默认 'left' ）
	 * @property {String} 					wordWrap	文字换行，可选值break-word|normal|anywhere（默认 'normal' ）
	 * @event {Function} click  点击触发事件
	 * @example <uv-text text="我用十年青春,赴你最后之约"></uv-text>
	 */
	const _sfc_main$2 = {
		name: 'uv-text',
		emits: ['click'],




		mixins: [mpMixin, mixin, value, props$1],

		computed: {
			valueStyle() {
				const style = {
					textDecoration: this.decoration,
					fontWeight: this.bold ? 'bold' : 'normal',
					wordWrap: this.wordWrap,
					fontSize: this.$uv.addUnit(this.size)
				};
				!this.type && (style.color = this.color);
				this.isNvue && this.lines && (style.lines = this.lines);
				if(this.isNvue && this.mode != 'price' && !this.prefixIcon && !this.suffixIcon) {
					 style.flex = 1;
					 style.textAlign = this.align === 'left' ? 'flex-start' : this.align === 'center' ? 'center' : 'right';
				}
				this.lineHeight && (style.lineHeight = this.$uv.addUnit(this.lineHeight));
				!this.isNvue && this.block && (style.display = 'block');
				return this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle));
			},
			isNvue() {
				let nvue = false;



				return nvue
			},
			isMp() {
				let mp = false;



				return mp
			}
		},
		data() {
			return {}
		},
		methods: {
			clickHandler() {
				// 如果为手机号模式，拨打电话
				if (this.call && this.mode === 'phone') {
					makePhoneCall({
						phoneNumber: this.text
					});
				}
				this.$emit('click');
			}
		}
	};

function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  const _component_v_uni_text = index$i;
  const _component_uv_icon = resolveEasycom(resolveDynamicComponent("uv-icon"), __easycom_0);
  const _component_v_uni_view = index$g;
  const _component_uv_link = resolveEasycom(resolveDynamicComponent("uv-link"), __easycom_3);
  const _component_v_uni_button = index$x;

  return (_ctx.show)
    ? (openBlock(), createBlock(_component_v_uni_view, {
        key: 0,
        class: normalizeClass(["uv-text", []]),
        style: normalizeStyle({
        margin: _ctx.margin,
				justifyContent: _ctx.align === 'left' ? 'flex-start' : _ctx.align === 'center' ? 'center' : 'flex-end'
      }),
        onClick: $options.clickHandler
      }, {
        default: withCtx(() => [
          (_ctx.mode === 'price')
            ? (openBlock(), createBlock(_component_v_uni_text, {
                key: 0,
                class: normalizeClass(['uv-text__price', _ctx.type && `uv-text__value--${_ctx.type}`]),
                style: normalizeStyle([$options.valueStyle])
              }, {
                default: withCtx(() => [
                  createTextVNode("￥")
                ]),
                _: 1
              }, 8, ["class", "style"]))
            : createCommentVNode("", true),
          (_ctx.prefixIcon)
            ? (openBlock(), createBlock(_component_v_uni_view, {
                key: 1,
                class: "uv-text__prefix-icon"
              }, {
                default: withCtx(() => [
                  createVNode(_component_uv_icon, {
                    name: _ctx.prefixIcon,
                    customStyle: _ctx.$uv.addStyle(_ctx.iconStyle)
                  }, null, 8, ["name", "customStyle"])
                ]),
                _: 1
              }))
            : createCommentVNode("", true),
          (_ctx.mode === 'link')
            ? (openBlock(), createBlock(_component_uv_link, {
                key: 2,
                text: _ctx.value,
                href: _ctx.href,
                underLine: ""
              }, null, 8, ["text", "href"]))
            : (_ctx.openType && $options.isMp)
              ? (openBlock(), createBlock(_component_v_uni_button, {
                  key: 3,
                  class: "uv-reset-button uv-text__value",
                  style: normalizeStyle([$options.valueStyle]),
                  openType: _ctx.openType,
                  onGetuserinfo: _ctx.onGetUserInfo,
                  onContact: _ctx.onContact,
                  onGetphonenumber: _ctx.onGetPhoneNumber,
                  onError: _ctx.onError,
                  onLaunchapp: _ctx.onLaunchApp,
                  onOpensetting: _ctx.onOpenSetting,
                  lang: _ctx.lang,
                  "session-from": _ctx.sessionFrom,
                  "send-message-title": _ctx.sendMessageTitle,
                  "send-message-path": _ctx.sendMessagePath,
                  "send-message-img": _ctx.sendMessageImg,
                  "show-message-card": _ctx.showMessageCard,
                  "app-parameter": _ctx.appParameter
                }, {
                  default: withCtx(() => [
                    createTextVNode(toDisplayString(_ctx.value), 1)
                  ]),
                  _: 1
                }, 8, ["style", "openType", "onGetuserinfo", "onContact", "onGetphonenumber", "onError", "onLaunchapp", "onOpensetting", "lang", "session-from", "send-message-title", "send-message-path", "send-message-img", "show-message-card", "app-parameter"]))
              : (openBlock(), createBlock(_component_v_uni_text, {
                  key: 4,
                  class: normalizeClass(["uv-text__value", [
          _ctx.type && `uv-text__value--${_ctx.type}`,
          _ctx.lines && `uv-line-${_ctx.lines}`
        ]]),
                  style: normalizeStyle([$options.valueStyle])
                }, {
                  default: withCtx(() => [
                    createTextVNode(toDisplayString(_ctx.value), 1)
                  ]),
                  _: 1
                }, 8, ["style", "class"])),
          (_ctx.suffixIcon)
            ? (openBlock(), createBlock(_component_v_uni_view, {
                key: 5,
                class: "uv-text__suffix-icon"
              }, {
                default: withCtx(() => [
                  createVNode(_component_uv_icon, {
                    name: _ctx.suffixIcon,
                    customStyle: _ctx.$uv.addStyle(_ctx.iconStyle)
                  }, null, 8, ["name", "customStyle"])
                ]),
                _: 1
              }))
            : createCommentVNode("", true)
        ]),
        _: 1
      }, 8, ["style", "onClick"]))
    : createCommentVNode("", true)
}
const __easycom_1 = /*#__PURE__*/_export_sfc(_sfc_main$2, [['render',_sfc_render$1],['__scopeId',"data-v-6fde0f74"]]);

const props = {
	props: {
		// 头像图片路径(不能为相对路径)
		src: {
			type: String,
			default: ''
		},
		// 头像形状，circle-圆形，square-方形
		shape: {
			type: String,
			default: 'circle'
		},
		// 头像尺寸
		size: {
			type: [String, Number],
			default: 40
		},
		// 裁剪模式
		mode: {
			type: String,
			default: 'scaleToFill'
		},
		// 显示的文字
		text: {
			type: String,
			default: ''
		},
		// 背景色
		bgColor: {
			type: String,
			default: '#c0c4cc'
		},
		// 文字颜色
		color: {
			type: String,
			default: '#fff'
		},
		// 文字大小
		fontSize: {
			type: [String, Number],
			default: 18
		},
		// 显示的图标
		icon: {
			type: String,
			default: ''
		},
		// 显示小程序头像，只对百度，微信，QQ小程序有效
		mpAvatar: {
			type: Boolean,
			default: false
		},
		// 是否使用随机背景色
		randomBgColor: {
			type: Boolean,
			default: false
		},
		// 加载失败的默认头像(组件有内置默认图片)
		defaultUrl: {
			type: String,
			default: ''
		},
		// 如果配置了randomBgColor为true，且配置了此值，则从默认的背景色数组中取出对应索引的颜色值，取值0-19之间
		colorIndex: {
			type: [String, Number],
			// 校验参数规则，索引在0-19之间
			validator(n) {
				return range(n, [0, 19]) || n === ''
			},
			default: ''
		},
		// 组件标识符
		name: {
			type: String,
			default: ''
		},
		...uni.$uv?.props?.avatar
	}
};

const base64Avatar =
		"";
	/**
	 * Avatar  头像
	 * @description 本组件一般用于展示头像的地方，如个人中心，或者评论列表页的用户头像展示等场所。
	 * @tutorial https://www.uvui.cn/components/avatar.html
	 *
	 * @property {String}			src				头像路径，如加载失败，将会显示默认头像(不能为相对路径)
	 * @property {String}			shape			头像形状  （ circle (默认) | square）
	 * @property {String | Number}	size			头像尺寸，可以为指定字符串(large, default, mini)，或者数值 （默认 40 ）
	 * @property {String}			mode			头像图片的裁剪类型，与uni的image组件的mode参数一致，如效果达不到需求，可尝试传widthFix值 （默认 'scaleToFill' ）
	 * @property {String}			text			用文字替代图片，级别优先于src
	 * @property {String}			bgColor			背景颜色，一般显示文字时用 （默认 '#c0c4cc' ）
	 * @property {String}			color			文字颜色 （默认 '#ffffff' ）
	 * @property {String | Number}	fontSize		文字大小  （默认 18 ）
	 * @property {String}			icon			显示的图标
	 * @property {Boolean}			mpAvatar		显示小程序头像，只对百度，微信，QQ小程序有效  （默认 false ）
	 * @property {Boolean}			randomBgColor	是否使用随机背景色  （默认 false ）
	 * @property {String}			defaultUrl		加载失败的默认头像(组件有内置默认图片)
	 * @property {String | Number}	colorIndex		如果配置了randomBgColor为true，且配置了此值，则从默认的背景色数组中取出对应索引的颜色值，取值0-19之间
	 * @property {String}			name			组件标识符  （默认 'level' ）
	 * @property {Object}			customStyle		定义需要用到的外部样式
	 *
	 * @event    {Function}        click       点击组件时触发   index: 用户传递的标识符
	 * @example  <uv-avatar :src="src" mode="square"></uv-avatar>
	 */
	const _sfc_main$1 = {
		name: 'uv-avatar',
		emits: ['click'],
		mixins: [mpMixin, mixin, props],
		data() {
			return {
				// 如果配置randomBgColor参数为true，在图标或者文字的模式下，会随机从中取出一个颜色值当做背景色
				colors: ['#ffb34b', '#f2bba9', '#f7a196', '#f18080', '#88a867', '#bfbf39', '#89c152', '#94d554', '#f19ec2',
					'#afaae4', '#e1b0df', '#c38cc1', '#72dcdc', '#9acdcb', '#77b1cc', '#448aca', '#86cefa', '#98d1ee',
					'#73d1f1',
					'#80a7dc'
				],
				avatarUrl: this.src,
				allowMp: false
			}
		},
		watch: {
			// 监听头像src的变化，赋值给内部的avatarUrl变量，因为图片加载失败时，需要修改图片的src为默认值
			// 而组件内部不能直接修改props的值，所以需要一个中间变量
			src: {
				immediate: true,
				handler(newVal) {
					this.avatarUrl = newVal;
					// 如果没有传src，则主动触发error事件，用于显示默认的头像，否则src为''空字符等的时候，会无内容展示
					if(!newVal) {
						this.errorHandler();
					}
				}
			}
		},
		computed: {
			imageStyle() {
				const style = {};
				return style
			}
		},
		created() {
			this.init();
		},
		methods: {
			init() {
				// 目前只有这几个小程序平台具有open-data标签
				// 其他平台可以通过uni.getUserInfo类似接口获取信息，但是需要弹窗授权(首次)，不合符组件逻辑
				// 故目前自动获取小程序头像只支持这几个平台



			},
			// 判断传入的name属性，是否图片路径，只要带有"/"均认为是图片形式
			isImg() {
				return this.src.indexOf('/') !== -1
			},
			// 图片加载时失败时触发
			errorHandler() {
				this.avatarUrl = this.defaultUrl || base64Avatar;
			},
			clickHandler() {
				this.$emit('click', this.name);
			}
		}
	};

function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  const _component_uv_icon = resolveEasycom(resolveDynamicComponent("uv-icon"), __easycom_0);
  const _component_uv_text = resolveEasycom(resolveDynamicComponent("uv-text"), __easycom_1);
  const _component_v_uni_image = index$q;
  const _component_v_uni_view = index$g;

  return (openBlock(), createBlock(_component_v_uni_view, {
    class: normalizeClass(["uv-avatar", [`uv-avatar--${_ctx.shape}`]]),
    style: normalizeStyle([{
			backgroundColor: (_ctx.text || _ctx.icon) ? (_ctx.randomBgColor ? $data.colors[_ctx.colorIndex !== '' ? _ctx.colorIndex : _ctx.$uv.random(0, 19)] : _ctx.bgColor) : 'transparent',
			width: _ctx.$uv.addUnit(_ctx.size),
			height: _ctx.$uv.addUnit(_ctx.size),
		}, _ctx.$uv.addStyle(_ctx.customStyle)]),
    onClick: $options.clickHandler
  }, {
    default: withCtx(() => [
      renderSlot(_ctx.$slots, "default", {}, () => [
        (_ctx.mpAvatar && $data.allowMp)
          ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [], 64))
          : (_ctx.icon)
            ? (openBlock(), createBlock(_component_uv_icon, {
                key: 1,
                name: _ctx.icon,
                size: _ctx.fontSize,
                color: _ctx.color
              }, null, 8, ["name", "size", "color"]))
            : (_ctx.text)
              ? (openBlock(), createBlock(_component_uv_text, {
                  key: 2,
                  text: _ctx.text,
                  size: _ctx.fontSize,
                  color: _ctx.color,
                  align: "center",
                  customStyle: "justify-content: center"
                }, null, 8, ["text", "size", "color"]))
              : (openBlock(), createBlock(_component_v_uni_image, {
                  key: 3,
                  class: normalizeClass(["uv-avatar__image", [`uv-avatar__image--${_ctx.shape}`]]),
                  src: $data.avatarUrl || _ctx.defaultUrl,
                  mode: _ctx.mode,
                  onError: $options.errorHandler,
                  style: normalizeStyle([{
					width: _ctx.$uv.addUnit(_ctx.size),
					height: _ctx.$uv.addUnit(_ctx.size)
				}])
                }, null, 8, ["class", "src", "mode", "onError", "style"]))
      ], true)
    ]),
    _: 3
  }, 8, ["class", "style", "onClick"]))
}
const __easycom_2 = /*#__PURE__*/_export_sfc(_sfc_main$1, [['render',_sfc_render],['__scopeId',"data-v-98df1e24"]]);

const _sfc_main = {
  __name: 'userinfo',
  setup(__props) {

const main = useMainStore();
const { openid, lang } = storeToRefs(main);

const title = ref('用户设置');

// 获取导航栏高度
const { navbarHeightCss } = useNavbarHeight();

	// 返回上一页
	const $onClickLeft = () => {
		navigateBack();
	};

//const currentDate = ref('')
const date = ref('');
const member = ref({});

onLoad(() => {
	member.value = main.member;
	//this.$util
	member.value.createTime = formatDateTime(member.value.createTime);
});	
onShow(() => {
	date.value = getDate({});
});

const startDate = computed(() => { 
	return getDate('start');
});
const endDate = computed(() => { 
	return getDate('end');
});

const chooseavatar = (e) => {
	console.log('detal:',e.detail);
	uploadFile({
		url: VUE_APP_UPLOAD_URL, 
		filePath: e.detail.avatarUrl,
		name: 'file',
		header: {
			Authorization: 'Bearer ' + member.value.accessToken,
			lang: lang.value,
			'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
		},
		success(uploadFileResult){
			console.log('uploadFileResult:',uploadFileResult);
			if (uploadFileResult) {
				const upload = JSON.parse(uploadFileResult.data);
				console.log('upload:',upload.data);
				member.value.avatar = upload.data;
			}
		}, 
		fail(e){
			console.log('网络链接错误');
			console.log(e);
		}
	});
};
const getDate = (type) => {
	const date = new Date();
	let year = date.getFullYear();
	let month = date.getMonth() + 1;
	let day = date.getDate();

	if (type === 'start') {
		year = year - 60;
	} else if (type === 'end') {
		year = year + 2;
	}
	month = month > 9 ? month : '0' + month;	day = day > 9 ? day : '0' + day;
	return `${year}-${month}-${day}`;
};
const handleDateChange = (e) => {
	member.value.birthday = e.target.value;
};
const save = async() => {
	let data = await userEdit({
		nickname: member.value.nickname,
		mobile: member.value.mobile,
		gender: member.value.gender,
		birthday: member.value.birthday,
		avatar: member.value.avatar
	});
	if (data) {
		const member2 = Object.assign(main.member, member.value);
		main.SET_MEMBER(member2);	
	}
	
};
	

return (_ctx, _cache) => {
  const _component_uv_navbar = resolveEasycom(resolveDynamicComponent("uv-navbar"), __easycom_0$1);
  const _component_v_uni_view = index$g;
  const _component_uv_avatar = resolveEasycom(resolveDynamicComponent("uv-avatar"), __easycom_2);
  const _component_v_uni_button = index$x;
  const _component_list_cell = resolveEasycom(resolveDynamicComponent("list-cell"), __easycom_2$1);
  const _component_v_uni_input = Input;
  const _component_v_uni_picker = index$7;

  return (openBlock(), createElementBlock(Fragment, null, [
    createVNode(_component_uv_navbar, {
      fixed: true,
      title: title.value,
      "left-arrow": "",
      onLeftClick: $onClickLeft
    }, null, 8, ["title"]),
    createVNode(_component_v_uni_view, {
      class: "container d-flex flex-column",
      style: normalizeStyle(`padding-top: ${unref(navbarHeightCss)};`)
    }, {
      default: withCtx(() => [
        createVNode(_component_v_uni_view, { class: "flex-fill form" }, {
          default: withCtx(() => [
            createVNode(_component_list_cell, { hover: false }, {
              default: withCtx(() => [
                createVNode(_component_v_uni_view, { class: "form-input w-100 d-flex align-items-center" }, {
                  default: withCtx(() => [
                    createVNode(_component_v_uni_view, { class: "label" }, {
                      default: withCtx(() => [
                        createTextVNode("头像")
                      ]),
                      _: 1
                    }),
                    createVNode(_component_v_uni_view, { class: "input flex-fill" }, {
                      default: withCtx(() => [
                        createVNode(_component_v_uni_view, {
                          class: "form-input w-100 d-flex align-items-center",
                          style: {"position":"relative"}
                        }, {
                          default: withCtx(() => [
                            createVNode(_component_v_uni_view, { class: "flex user-box align-items-center" }, {
                              default: withCtx(() => [
                                createVNode(_component_v_uni_view, { class: "mr-1" }, {
                                  default: withCtx(() => [
                                    createVNode(_component_uv_avatar, {
                                      src: member.value.avatar,
                                      size: "60"
                                    }, null, 8, ["src"])
                                  ]),
                                  _: 1
                                }),
                                (!member.value.avatar)
                                  ? (openBlock(), createBlock(_component_v_uni_view, {
                                      key: 0,
                                      class: "flex-1",
                                      style: {"right":"0","height":"60rpx"}
                                    }, {
                                      default: withCtx(() => [
                                        createVNode(_component_v_uni_button, {
                                          style: {"background-color":"#dd524d","color":"#fff"},
                                          size: "mini",
                                          "open-type": "chooseAvatar",
                                          onChooseavatar: chooseavatar,
                                          type: "success"
                                        }, {
                                          default: withCtx(() => [
                                            createTextVNode("更改头像")
                                          ]),
                                          _: 1
                                        })
                                      ]),
                                      _: 1
                                    }))
                                  : createCommentVNode("", true)
                              ]),
                              _: 1
                            })
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            createVNode(_component_list_cell, { hover: false }, {
              default: withCtx(() => [
                createVNode(_component_v_uni_view, { class: "form-input w-100 d-flex align-items-center" }, {
                  default: withCtx(() => [
                    createVNode(_component_v_uni_view, { class: "label" }, {
                      default: withCtx(() => [
                        createTextVNode("昵称")
                      ]),
                      _: 1
                    }),
                    createVNode(_component_v_uni_view, { class: "input flex-fill" }, {
                      default: withCtx(() => [
                        createVNode(_component_v_uni_input, {
                          type: "nickname",
                          placeholder: "请填写昵称",
                          "placeholder-class": "text-color-assist font-size-base",
                          modelValue: member.value.nickname,
                          "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((member.value.nickname) = $event))
                        }, null, 8, ["modelValue"])
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            createVNode(_component_list_cell, { hover: false }, {
              default: withCtx(() => [
                createVNode(_component_v_uni_view, {
                  class: "form-input w-100 d-flex align-items-center",
                  style: {"position":"relative"}
                }, {
                  default: withCtx(() => [
                    createVNode(_component_v_uni_view, { class: "label" }, {
                      default: withCtx(() => [
                        createTextVNode("手机号码")
                      ]),
                      _: 1
                    }),
                    createVNode(_component_v_uni_view, { class: "input flex-fill" }, {
                      default: withCtx(() => [
                        createVNode(_component_v_uni_input, {
                          type: "text",
                          modelValue: member.value.mobile,
                          "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((member.value.mobile) = $event)),
                          disabled: ""
                        }, null, 8, ["modelValue"])
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            createVNode(_component_list_cell, { hover: false }, {
              default: withCtx(() => [
                createVNode(_component_v_uni_view, { class: "form-input w-100 d-flex align-items-center" }, {
                  default: withCtx(() => [
                    createVNode(_component_v_uni_view, { class: "label" }, {
                      default: withCtx(() => [
                        createTextVNode("性别")
                      ]),
                      _: 1
                    }),
                    createVNode(_component_v_uni_view, { class: "input flex-fill" }, {
                      default: withCtx(() => [
                        createVNode(_component_v_uni_view, { class: "radio-group" }, {
                          default: withCtx(() => [
                            createVNode(_component_v_uni_view, {
                              class: normalizeClass(["radio", {'checked': member.value.gender == '0'}]),
                              style: {"margin-right":"10rpx"},
                              onClick: _cache[2] || (_cache[2] = $event => (member.value.gender=0))
                            }, {
                              default: withCtx(() => [
                                createTextVNode("先生")
                              ]),
                              _: 1
                            }, 8, ["class"]),
                            createVNode(_component_v_uni_view, {
                              class: normalizeClass(["radio", {'checked': member.value.gender == '1'}]),
                              onClick: _cache[3] || (_cache[3] = $event => (member.value.gender=1))
                            }, {
                              default: withCtx(() => [
                                createTextVNode("女士")
                              ]),
                              _: 1
                            }, 8, ["class"])
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            createVNode(_component_list_cell, {
              hover: false,
              arrow: !member.value.birthday
            }, {
              default: withCtx(() => [
                createVNode(_component_v_uni_view, { class: "form-input w-100 d-flex align-items-center" }, {
                  default: withCtx(() => [
                    createVNode(_component_v_uni_view, { class: "label" }, {
                      default: withCtx(() => [
                        createTextVNode("生日")
                      ]),
                      _: 1
                    }),
                    createVNode(_component_v_uni_view, { class: "input flex-fill" }, {
                      default: withCtx(() => [
                        createVNode(_component_v_uni_picker, {
                          mode: "date",
                          value: member.value.birthday,
                          start: startDate.value,
                          end: endDate.value,
                          onChange: handleDateChange
                        }, {
                          default: withCtx(() => [
                            createTextVNode(toDisplayString(member.value.birthday ? member.value.birthday : '无'), 1)
                          ]),
                          _: 1
                        }, 8, ["value", "start", "end"])
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["arrow"]),
            createVNode(_component_list_cell, {
              hover: false,
              last: ""
            }, {
              default: withCtx(() => [
                createVNode(_component_v_uni_view, { class: "form-input w-100 d-flex align-items-center" }, {
                  default: withCtx(() => [
                    createVNode(_component_v_uni_view, { class: "label" }, {
                      default: withCtx(() => [
                        createTextVNode("加入时间")
                      ]),
                      _: 1
                    }),
                    createVNode(_component_v_uni_view, { class: "input flex-fill" }, {
                      default: withCtx(() => [
                        createVNode(_component_v_uni_input, {
                          type: "text",
                          modelValue: member.value.createTime,
                          "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => ((member.value.createTime) = $event)),
                          disabled: ""
                        }, null, 8, ["modelValue"])
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        createVNode(_component_v_uni_view, { class: "btn-box d-flex align-items-center just-content-center" }, {
          default: withCtx(() => [
            createVNode(_component_v_uni_button, {
              type: "primary",
              class: "save-btn",
              onClick: save
            }, {
              default: withCtx(() => [
                createTextVNode("保存")
              ]),
              _: 1
            })
          ]),
          _: 1
        })
      ]),
      _: 1
    }, 8, ["style"])
  ], 64))
}
}

};
const userinfo = /*#__PURE__*/_export_sfc(_sfc_main, [['__scopeId',"data-v-06e3dbb4"]]);

export { userinfo as default };
